package com.itdianzi.exceptions;

import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class CustomExceptionResolver implements HandlerExceptionResolver {

	public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {

		ex.printStackTrace();

		ModelAndView mv = new ModelAndView();

		mv.addObject("errorMsg","对不起我错了，请打120");
		mv.addObject("ex",ex);

		mv.setViewName("error");

		return mv;
	}
}